package cn.zlb.frame.infrastructure.util.persistence.pay;

import cn.zlb.frame.domain.pay.model.entity.PaymentEntity;
import cn.zlb.frame.domain.pay.respository.persistence.IPayRepository;
import cn.zlb.frame.infrastructure.util.mysql.PaymentMapper;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @author yangjie.deng@resico.cn
 * @date 2023-11-14 10:53:38
 * @describe class responsibility
 */
@Service
public class PayRepository implements IPayRepository {
    @Resource
    private PaymentMapper paymentMapper;

    @Override
    public PaymentEntity findThirdPayRequireInfo(PaymentEntity entity) {
        // todo 查询
        // entity convert to PO
        // query detail info.
        // final LambdaQueryWrapper<PaymentPO> wrapper = Wrappers.lambdaQuery(PaymentPO.class)
        //        .eq(PaymentPO::getPaymentNo, entity.getPaymentNo());
        // paymentMapper.selectList(wrapper);

        return entity;
    }

    @Override
    public PaymentEntity save(PaymentEntity entity) {
        // entity convert to PO
        // save PO call paymentMapper.insert();
        // paymentMapper.insert();

        entity.setPaymentNo("P100001");
        return entity;
    }
}
